package com.ocom.webapi.controller;

import com.ocom.common.constant.WebApiServiceUrl;
import com.ocom.common.entity.payconfig.EntityRestStaff;
import com.ocom.common.request.payconfig.food.GetFoodstuffListRequest;
import com.ocom.common.request.payconfig.staff.GetRestStaffListRequest;
import com.ocom.common.request.payconfig.staff.RemoveRestStaffRequest;
import com.ocom.common.resp.Result;
import com.ocom.webapi.feign.PayConfigClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@PreAuthorize("@pms.hasRole('ROLE_WEB')" )
public class RestStaffPageController {


    @Autowired
    PayConfigClientService payConfigClientService;

    //6.10.1获取餐厅职工列表（RestStaffPage/onShow）
    @PostMapping(WebApiServiceUrl.Url_RestStaffPageOnShow)
    public Result onShow(@RequestBody GetRestStaffListRequest request) {
        return payConfigClientService.getRestStaffList(request);
    }

    //6.10.2删除餐厅职工（RestStaffPage/delete）
    @PostMapping(WebApiServiceUrl.Url_RestStaffPageDelete)
    public Result delete(@RequestBody RemoveRestStaffRequest request) {
        return payConfigClientService.removeRestStaff(request);
    }

    //6.10.3添加餐厅职工（RestStaffPage/add）
    @PostMapping(WebApiServiceUrl.Url_RestStaffPageAdd)
    public Result add(@RequestBody EntityRestStaff request) {
        return payConfigClientService.newRestStaff(request);
    }

    //6.10.4修改餐厅职工（RestStaffPage/modify）
    @PostMapping(WebApiServiceUrl.Url_RestStaffPageModify)
    public Result modify(@RequestBody EntityRestStaff request) {
        return payConfigClientService.updateRestStaff(request);
    }

}
